Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(account): keep all accounts in memory #174

Merged
merged 31 commits into from
Dec 18, 2020

Conversation

lucasfernog
Copy link
Contributor

Description of change

Instead of loading the account from storage and saving on each operation, we'll keep the account references stored on the AccountManager struct, wrapped on Arc<RwLock<>> for thread safety. This prevents race conditions between e.g. the polling system and the transfer API, where account data can be lost.

Type of change

  • Refactor

How the change has been tested

Unit tests + faucet.

Change checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked that new and existing unit tests pass locally with my changes

src/account/mod.rs Outdated Show resolved Hide resolved
src/account/mod.rs Outdated Show resolved Hide resolved
src/account/mod.rs Outdated Show resolved Hide resolved
src/monitor.rs Outdated Show resolved Hide resolved
src/monitor.rs Outdated Show resolved Hide resolved
src/account_manager.rs Outdated Show resolved Hide resolved
src/account_manager.rs Outdated Show resolved Hide resolved
src/account_manager.rs Outdated Show resolved Hide resolved
src/account_manager.rs Outdated Show resolved Hide resolved
src/account_manager.rs Outdated Show resolved Hide resolved
@lucasfernog
Copy link
Contributor Author

Next steps (separate PRs):

  • remove anyhow usage
  • add AccountManager builder
  • stronghold refactor

src/account_manager.rs Outdated Show resolved Hide resolved
src/account_manager.rs Outdated Show resolved Hide resolved
src/account_manager.rs Outdated Show resolved Hide resolved
src/account_manager.rs Outdated Show resolved Hide resolved
@lucasfernog lucasfernog merged commit f56e1cf into develop Dec 18, 2020
@lucasfernog lucasfernog deleted the fix/account-storage branch December 18, 2020 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants